package com.gxa.controller.fwgl.yhgl;

import com.github.pagehelper.PageHelper;
import com.gxa.pojo.dto.fwgl.CheckInDto;
import com.gxa.pojo.dto.fwgl.CheckOutDto;
import com.gxa.pojo.entity.fwgl.TCheckIn;
import com.gxa.pojo.entity.fwgl.TCheckOut;
import com.gxa.service.fwgl.yhgl.CheckInService;
import com.gxa.service.fwgl.yhgl.CheckOutService;
import com.gxa.utils.QueryResult;
import com.gxa.utils.Result;
import com.gxa.utils.ResultUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author：lizhijun
 * @Package：{PROJECT_NAME}
 * @name：{DATE} {NAME}
 */
@RestController
@RequestMapping("/checkout")
public class CheckOutController {
    @Resource
    private CheckOutService checkOutService;

    @GetMapping("/queryAll")
    public Result queryAll(CheckOutDto checkOutDto){

        QueryResult queryResult = checkOutService.queryAll(checkOutDto);
        return ResultUtils.buildSuccess(queryResult.getData(),queryResult.getCount());
    }
    @RequestMapping("/add")
    public Result addCheckOut(TCheckOut checkOut){
        checkOutService.add(checkOut);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/update")
    public Result updateCheckOut(TCheckOut checkOut){
        checkOutService.update(checkOut);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/delete")
    public Result deleteCheck(Integer id){
        checkOutService.delete(id);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/find")
    public Result findTypeByName(String patientName){
        checkOutService.findByName(patientName);
        return ResultUtils.buildSuccess();
    }
}
